# Contributor: Natanael Copa <ncopa@alpinelinux.org>
# Contributor: Michał Polański <michal@polanski.me>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=sshguard
pkgver=2.4.2
pkgrel=0
pkgdesc="Protects hosts from brute-force attacks against SSH and other services"
url="https://www.sshguard.net/"
arch="all"
license="ISC"
depends="iptables"
makedepends="flex bison autoconf automake libtool"
subpackages="$pkgname-openrc $pkgname-doc"
source="https://downloads.sourceforge.net/project/sshguard/sshguard/$pkgver/sshguard-$pkgver.tar.gz
	sshguard.initd
	sshguard.confd
	"

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install

	install -Dm755 "$srcdir"/sshguard.initd "$pkgdir"/etc/init.d/sshguard
	install -Dm644 "$srcdir"/sshguard.confd "$pkgdir"/etc/conf.d/sshguard
}

sha512sums="f2fe35180af8698d4b2053e9ffbf17df9f033b0c2fcc045caa085467d14174e17aa266d2ef3ce9536037e54f7d3ea42de9e32e7faee65612894294793082862a  sshguard-2.4.2.tar.gz
e7f3960c9ea04a5a6bfb17fba79131f063a0128f3f2e85e1f4c6689c3c83c4ed8a65bebf9ae5c0b0925186282409bab660be3ac2483a6385652fe997e5f2bd2c  sshguard.initd
2d314943268dc5716bb564c236adc6695a22e38df31cb9f945e050cbb07864002975e7de2f3b2d492f961cf11328826a4a0b6db4284cd6d74de8a9ad02601e54  sshguard.confd"
